package com.xmmj.common.room.dao

import androidx.room.*
import com.xmmj.common.room.entity.AccountBean

/**
 * 搜索历史的工具类
 */
@Dao
interface AccountDao {
    @Insert
    suspend fun insert(vararg account: AccountBean)

    @Insert
    suspend fun insert(accountList: List<AccountBean>)

    @Delete
    suspend fun delete(vararg account: AccountBean): Int

    @Delete
    suspend fun delete(accountList: List<AccountBean>): Int

    @Update
    suspend fun update(vararg account: AccountBean): Int

    @Update
    suspend fun update(accountList: List<AccountBean>): Int

    @Query("SELECT * FROM account ORDER BY id ASC")
    suspend fun searchAll(): List<AccountBean>?

    @Query("SELECT * FROM account WHERE id =:id")
    suspend fun searchById(id: String): List<AccountBean>?

    @Query("DELETE FROM account")
    suspend fun deleteAll()
}